import 'package:flutter/material.dart';
import 'package:shop_project/model/category.dart';

class ChildCategory with ChangeNotifier {
  List<BxMallSubDto> childCategoryList = [];
  int childIndex = 0;
  String categoryId = '4';
  String subId = '';
  String noMoreText = '';
  int pageIndex = 1;

  setChildCategory(List<BxMallSubDto> list, String cId) {
    pageIndex = 1;
    noMoreText = '';
    childIndex = 0;
    categoryId = cId;
    BxMallSubDto bxMallSubDto = BxMallSubDto();
    bxMallSubDto.comments = '';
    bxMallSubDto.mallSubId = '';
    bxMallSubDto.mallCategoryId = '00';
    bxMallSubDto.mallSubName = '全部';
    childCategoryList = [bxMallSubDto];
    childCategoryList.addAll(list);
    notifyListeners();
  }

  changeChildIndex(int index, String id) {
    pageIndex = 1;
    noMoreText = '';
    childIndex = index;
    subId = id;
    notifyListeners();
  }

  addPageIndex() {
    pageIndex++;
  }

  changeNoMore(String text) {
    noMoreText = text;
    notifyListeners();
  }
}
